Mac OS X中MacPorts安装和使用
Mac OS X中MacPorts安装和使用
macOS macPort
Mac OS X中MacPorts安装和使用
发表于 2012-10-18 由 owen
转自:http://www.ccvita.com/434.html
//官方文档
http://guide.macports.org/#development.practices.install-docs
Mac下面除了用dmg、pkg来安装软件外,比较方便的还有用MacPorts来帮助你安装其他应用程序,跟BSD中的ports道理一样。MacPorts就像apt-get、yum一样,可以快速安装些软件。
下面将MacPorts的安装和使用方法记录在这里以备查。
通过Source安装MacPorts
wget http://distfiles.macports.org/MacPorts/MacPorts-1.9.2.tar.gz
tar zxvf MacPorts-1.9.2.tar.gz
cd MacPorts-1.9.2
./configure && make && sudo make install
cd ../
rm -rf MacPorts-1.9.2*
然后将/opt/local/bin和/opt/local/sbin添加到$PATH搜索路径中
编辑/etc/profile文件中,加上
export PATH=/opt/local/bin:$PATH
export PATH=/opt/local/sbin:$PATH
如果无法修改/etc/profile文件,则执行sudo chmod 777 /etc/profile
然后再添加保存
MacPorts使用
更新ports tree和MacPorts版本,强烈推荐第一次运行的时候使用-v参数,显示详细的更新过程。
sudo port -v selfupdate
搜索索引中的软件
port search name
安装新软件
sudo port install name
卸载软件
sudo port uninstall name
查看有更新的软件以及版本
port outdated
升级可以更新的软件
sudo port upgrade outdated
Eclipse的插件需要subclipse需要JavaHL,下面通过MacPorts来安装
sudo port install subversion-javahlbindings
//安装svn 1.7.7
sudo port install subversion 1.7.7
The upgrade action upgrades installed ports and their dependencies when a Portfile in the repository has been updated after a port was installed.
%% sudo port upgrade gnome
If you wish not to upgrade a port’s dependencies, use the -n switch. Note that this will often cause problems.
%% sudo port -n upgrade gnome
If you’d like to upgrade all outdated ports, use this command.
%% sudo port upgrade outdated
Note
The upgrade action by default does not uninstall an upgraded port —it deactivates it. See section Port Images, and also Destroot and Activate phases in Port Phases. If you wish to uninstall the old version, use the -u option.
%% sudo port -u upgrade vile

